﻿// 等待所有加载
$(window).load(function () {
    $('body').addClass('loaded');
    $('#loader-wrapper .load_title').remove();
});

var frameId = window.frameElement && window.frameElement.id || '';
//var frameHeight = window.frameElement.scrollHeight - 40;
//$("#contentdiv").css("height", frameHeight + "px");
var index = layer.load(1);
GetObjectInfoFunction("Admin/Handler/BaseHand/MenuHand.ashx", { "act": "InitData", "MenuCode": frameId }, function (result) {
    layer.close(index);
    if (result.IsSuccess) {
        if (result.data.length == 0)
            return;

        var html = "";
        for (var i = 0; i < result.data.length; i++) {
            var item = result.data[i];
            html += '<button type="button" class="layui-btn layui-btn-sm" lay-event="' + item.MenuCode + '">';
            html += '<i class="layui-icon ' + item.MenuIcon + '"></i>' + item.MenuName;
            html += '</button >';
        }

        var toolbarMenuHtml = document.getElementById("toolbarMenu").innerHTML;
        var newMenuHtml = toolbarMenuHtml.replace(/#/, html);
        $("#toolbarMenu").html(newMenuHtml);
    }
})